﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ChildPartCollider : EnemyBase
{
    void Start()
    {

    }

    void Update()
    {

    }

    public override void OnTriggerEnter2D(Collider2D collision)
    {
        if (transform.parent != null)
        {
            transform.parent.SendMessage("OnTriggerEnter2D", collision);
        }
    }

    public override void OnCollisionEnter2D(Collision2D collision)
    {
        if (transform.parent != null)
        {
            transform.parent.SendMessage("OnCollisionEnter2D", collision);
        }
    }

    public override float Damage(GameObject source, float value)
    {

        if (transform.parent != null)
        {
            EnemyBase enemy = transform.parent.GetComponent<EnemyBase>();
            if (enemy != null)
            {
                return enemy.Damage(source, value);
            }
        }
        return -1;
    }

    public override void Run()
    {
        if (transform.parent != null)
        {
            EnemyBase enemy = transform.parent.GetComponent<EnemyBase>();
            if (enemy != null)
            {
                enemy.Run();
            }
        }
    }
    public override void Stop()
    {
        if (transform.parent != null)
        {
            EnemyBase enemy = transform.parent.GetComponent<EnemyBase>();
            if (enemy != null)
            {
                enemy.Stop();
            }
        }
    }

    public override void Die()
    {
        throw new NotImplementedException();
    }

    public override bool IsDie()
    {
        throw new NotImplementedException();
    }
}
